//
//  UIImage+UIImage_Helper.h
//  BaseTools
//
//  Created by 李挺哲 on 15/8/12.
//  Copyright (c) 2015年 ltz. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>
#import <QuartzCore/QuartzCore.h>
#define ImageScale 0.2
#define LogoImageMargin 5

@interface UIImage (UIImage_Helper)
/**
 *  模糊
 *
 *  @param blurAmount // 0.0 to 1.0
 *
 *  @return <#return value description#>
 */
- (UIImage*)blurredImage:(CGFloat)blurAmount;
/**
 *  截屏
 *
 *  @return <#return value description#>
 */
+ (UIImage *)screenshot;
/**
 *  初始化纯色Image
 *
 *  @param color <#color description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)imageWithColor:(UIColor *)color;
/**
 *  调整方向
 *
 *  @return <#return value description#>
 */
-(UIImage *)imageWithFixedOrientation;


/**
 *  图片拉伸
 *
 *  @param name <#name description#>
 *
 *  @return <#return value description#>
 */
+(UIImage *)resizedImage:(NSString *)name;


/**
 *  图片拉伸 (上左 像素不被拉伸 其余角 同样)
 *
 *  @param name <#name description#>
 *  @param left <#left description#>
 *  @param top  <#top description#>
 *
 *  @return <#return value description#>
 */
+(UIImage *)resizedImage:(NSString *)name left:(CGFloat)left top:(CGFloat)top;



/**
 *  截屏方法
 *
 *  @param renderView <#renderView description#>
 *
 *  @return <#return value description#>
 */
+(instancetype)renderView:(UIView *)renderView;


/**
 *  图片加水印
 *
 *  @param bg    <#bg description#>
 *  @param water <#water description#>
 *
 *  @return <#return value description#>
 */
+(instancetype)waterWithBgName:(NSString *)bg waterLogo:(NSString *)water;

/**
 *  裁剪图片为圆
 *
 *  @param name
 *  @param bordersW    外边框宽度
 *  @param borderColor 线的颜色
 *
 *  @return <#return value description#>
 */
+(instancetype)clipRoundWithImageName:(NSString*)name bordersW:(CGFloat)bordersW borderColor:(UIColor *)borderColor;

/**
 *  设置图片的背景颜色
 *
 *  @param color <#color description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)imageWithBackGroundColor:(UIColor *)color;



/**
 *  生成一维码图片
 *
 *  @param code   <#code description#>
 *  @param width  <#width description#>
 *  @param height <#height description#>
 *
 *  @return <#return value description#>
 */
+(UIImage *)generateQRCode:(NSString *)code width:(CGFloat)width height:(CGFloat)height;

/**
 *  生成二维码图片
 *
 *  @param code   <#code description#>
 *  @param width  <#width description#>
 *  @param height <#height description#>
 *
 *  @return <#return value description#>
 */
+(UIImage *)generateBarCode:(NSString *)code width:(CGFloat)width height:(CGFloat)height ;
/**
 *  UIView 变成Uiimage
 *
 *  @param theView <#theView description#>
 *
 *  @return <#return value description#>
 */
+(UIImage*)viewConvertTOImage:(UIView *)theView;


/**
 *  等比缩放
 *
 *  @param image     <#image description#>
 *  @param scaleSize <#scaleSize description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)scaleImage:(UIImage *)image toScale:(float)scaleSize;




/**
 *  获取UIImage  某处(x,y) 的亮度
 *
 *  @param x  <#x description#>
 *  @param y  <#y description#>
 *  @param oB 亮度初始值 一般默认为0
 *
 *  @return <#return value description#>
 */
- (float )getBrightsFromImage :(int)x andY:(int)y  orginBright:(float) oB;



/**
 *  获取UIImage  整体亮度  一般< 128 为暗
 *
 *  @return <#return value description#>
 */
- (int)getBright ;

/**
 *  获取Uiimage旋转后的图片
 *
 *  @param orientation 旋转度数
 *
 *  @return 旋转后的图片
 */
-(UIImage *)getRotationImage :(UIImageOrientation)orientation;



@end
